package com.wjn.wjnpicturebackend.common;

import com.wjn.wjnpicturebackend.exception.ErrorCode;
import lombok.Data;

import java.io.Serializable;

/**
 * ClassName: BaseResponse
 * Package: com.wjn.wjnpicturebackend.common
 * Description:
 *
 * @Author cqupt-wjn
 * @Create 2025/6/15 17:13
 * @Version 1.0
 */
@Data
public class BaseResponse<T> implements Serializable {
    private int code;

    private T data;

    private String message;

    public BaseResponse(int code, T data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }

    public BaseResponse(int code, T data) {
        this(code, data, "");
    }

    public BaseResponse(ErrorCode errorCode) {
        this(errorCode.getCode(), null, errorCode.getMessage());
    }
}
